Skip to content

Conversation

@karolzwolak
Copy link
Member

@karolzwolak karolzwolak commented Nov 13, 2025

Before this PR extra flags from env variables like RUSTFLAGS had lower precedence than bootstrap flags. This PR changes that, and tus makes overriding flags passed to the compiler easier and more reliable.
This is technically a breaking change — but it only affects people using these env variables.

This change was discussed on zulip by members of bootstrap team.

r? @Kobzol

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 13, 2025
@karolzwolak karolzwolak force-pushed the bootstrap-rustflags-precedence branch 2 times, most recently from ce939ab to 456ce9a Compare November 13, 2025 15:59
@karolzwolak
Copy link
Member Author

See also #148795 and #148782 for more context.

@rust-log-analyzer

This comment has been minimized.

@karolzwolak karolzwolak force-pushed the bootstrap-rustflags-precedence branch from 456ce9a to e0750a1 Compare November 13, 2025 16:35
@karolzwolak karolzwolak force-pushed the bootstrap-rustflags-precedence branch from e0750a1 to a0015a3 Compare November 14, 2025 17:52
@karolzwolak karolzwolak changed the title Flags from env variables like RUSTFLAGS now have precedence over bootstrap own flags and not the other way around. Flags from *FLAGS* env vars now have precedence over bootstrap own flags and not the other way around. Nov 14, 2025
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Left a few nits, but other than that, it looks good.

View changes since this review

@karolzwolak karolzwolak force-pushed the bootstrap-rustflags-precedence branch from a0015a3 to afa24cd Compare November 16, 2025 15:09
@karolzwolak karolzwolak changed the title Flags from *FLAGS* env vars now have precedence over bootstrap own flags and not the other way around. Make flags from *FLAGS* (such as RUSTFLAGS) env. vars. have precedence over flags set by bootstrap Nov 16, 2025
@karolzwolak
Copy link
Member Author

I addressed all the nits. Also reworded the commit and PR title to better match the updated change description in the tracker.

@Kobzol
Copy link
Member

Kobzol commented Nov 16, 2025

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 16, 2025

📌 Commit afa24cd has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 16, 2025
bors added a commit that referenced this pull request Nov 16, 2025
Rollup of 7 pull requests

Successful merges:

 - #148703 (Use `overflow_checks` intrinsic so `IterRangeFrom` yields MAX before panicking in debug)
 - #148881 (use `cfg_select!` to pick assembly in codegen test)
 - #148911 (Make flags from `*FLAGS*` (such as `RUSTFLAGS`) env. vars. have precedence over flags set by bootstrap)
 - #148914 (fix incorrect import in `std_detect` on `aarch64-unknown-openbsd`)
 - #148971 (Document Error::{new,other} as to be avoided in pre_exec)
 - #148983 (Use rustc target metadata for build-manifest target lists)
 - #148995 (add must_use to extract_if methods)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8c5606e into rust-lang:main Nov 16, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 16, 2025
rust-timer added a commit that referenced this pull request Nov 16, 2025
Rollup merge of #148911 - karolzwolak:bootstrap-rustflags-precedence, r=Kobzol

Make flags from `*FLAGS*` (such as `RUSTFLAGS`) env. vars. have precedence over flags set by bootstrap

Before this PR extra flags from env variables like `RUSTFLAGS` had lower precedence than bootstrap flags. This PR changes that, and tus makes overriding flags passed to the compiler easier and more reliable.
This is technically a breaking change — but it only affects people using these env variables.

This change was [discussed on zulip](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Precedence.20of.20RUSTFLAGS.20in.20bootstrap/with/554903280) by members of bootstrap team.

r? `@Kobzol`
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Nov 17, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#148703 (Use `overflow_checks` intrinsic so `IterRangeFrom` yields MAX before panicking in debug)
 - rust-lang#148881 (use `cfg_select!` to pick assembly in codegen test)
 - rust-lang#148911 (Make flags from `*FLAGS*` (such as `RUSTFLAGS`) env. vars. have precedence over flags set by bootstrap)
 - rust-lang#148914 (fix incorrect import in `std_detect` on `aarch64-unknown-openbsd`)
 - rust-lang#148971 (Document Error::{new,other} as to be avoided in pre_exec)
 - rust-lang#148983 (Use rustc target metadata for build-manifest target lists)
 - rust-lang#148995 (add must_use to extract_if methods)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants